package cn.ryh.filter.code;

import javax.servlet.*;
import java.io.IOException;

/**
 * @ClassName CodeFilter
 * @Description 通过代码注册过滤器Filter
 * @Author RaoYH
 */
public class CodeFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("CodeFilter过滤器初始化");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
            throws IOException, ServletException {
        System.out.println("CodeFilter过滤器执行过滤操作");

        filterChain.doFilter(servletRequest, servletResponse);
    }

    @Override
    public void destroy() {

        System.out.println("CodeFilter过滤器销毁");
    }
}
